<template>
  <div>
    <!--菜单-->
    <MenuComponent  :onEvent="clickMenu" :selectCodeEvent="selectCodeHandle"/>
    <button @click="changeStockCode">Change Stock Code</button>
<p>父组件：{{ stockCode }}</p>
    <!--主页-->
      <div class="main-container">
        <!-- <component :is="currentPage"/> -->
         <KLinePage/>
      </div>
  </div>
</template>


<script >
import MenuComponent from "./components/base/MenuComponent.vue";
import KLinePage from "./components/KLinePage.vue";
import TimeChartPage from "./components/TimeChartPage.vue";

export default {
  components: { 
    MenuComponent, 
    KLinePage,
    TimeChartPage
  },
  provide() {
    return {
      stockCode: this.stockCode,
      
    };
  },
  mounted() {
    // this.stockCode = '00009988'
    // stockCode = '00009988'
    // this.stockCode = this.code
  },
  data() {
    return {
      stockCode: '600909',
      data:1,
      // currentPage: "KLinePage"
    }
  },
  methods: {
      clickMenu(value) {
          console.log("接收数据" + value)
          // if (this.data !== value) {
          //   this.data = value
          //   if (this.data == 1) {
          //     this.currentPage = 'KLinePage'
          //   } else {
          //     this.currentPage = 'TimeChartPage'
          //   }
            
          // }
      },
      selectCodeHandle(value) {
        // console.log("接收数据" + this.stockCode)
        // this.stockCode = '11111'
        // this.stockCode = 'xxxxx'
        // console.log("接收数据" + this.stockCode)
      },
      changeStockCode() {
        // this.stockCode = 'xxxx'; // 新的股票代码
        this.stockCode = 'yyy'; // 新的股票代码
      }
  }
};
</script>

<style scoped>

</style>